<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'account.label', default: 'Account')}"/>
    <title>借款人(企业)</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    @media screen and (min-width:1900px) and (max-width:1920px) {
        .flex{
            display: flex;justify-content: center;align-items: center;
        }
    }
    .select2-container .select2-choices .select2-search-field input,.select2-container .select2-choice,.select2-container .select2-choices{

        color: #999;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">

<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right navFloatRight">
                <ol class="hbreadcrumb breadcrumb">
                    <li>
                        <span>CINDTATA PLS</span>
                    </li>
                    <li class="active">
                        <span>借款人(企业)</span>
                    </li>
                </ol>
            </div>
        </div>
    </div>
</div>

<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="mortgageAccountIndex" class="form-horizontal" role="form" id="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit" onclick="text()"><i class="fa fa-search"></i> 查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                            <i class="fa fa-times"></i> 重置</button>
                    </div>
                    查询
                </div>
                <div class="panel-body seach-group" id="bug1">
                    %{--第一行--}%
                    <div class="row">
                        <div class="form-group col-sm-4">
                            <label for="city" class="col-sm-3 control-label">城市</label>
                            <div class="col-sm-9">
                                <g:select class="form-control" name="city" id="city"
                                          from="${com.cindata.City.findAllByNameInList(new com.cindata.ComponentService().evaluate(com.cindata.Component.findByCode('showCity')), [sort: 'name', order: 'asc'])}"
                                          valueMessagePrefix="status" optionKey="zoneNumber" optionValue="name"
                                          value="${params?.city}"
                                          noSelection="${["-1": '请选择城市']}"/>
                                <input type="hidden" id="communityId" value="${params?.communityId}" name="communityId" />
                            </div>
                        </div>
                        <div class="form-group col-sm-4">
                            <label class="col-sm-3 control-label">信用评级</label>
                            <div class="col-sm-9 input-group" style="display: flex;justify-content: center">
                                <input type="text" class="form-control" name="creditLevel" id="creditLevel" value="${params?.creditLevel}" placeholder="请输入信用评级">
                            </div>
                        </div>
                        <div class="form-group col-sm-4">
                            <label class="col-sm-3 control-label">注册资金</label>
                            <div class="col-sm-7 input-group ">
                                <input type="text" class=" form-control " placeholder="请输入下限" maxlength="6"
                                       id="registeredCapitalStart" value="${params?.registeredCapitalStart}" name="registeredCapitalStart" />
                                <span class="input-group-addon">至</span>
                                <input type="text" class=" form-control " placeholder="请输入上限" maxlength="6"
                                       id="registeredCapitalEnd" value="${params?.registeredCapitalEnd}" name="registeredCapitalEnd" />
                            </div>
                            <div class="col-sm-2 p-t-xss">
                                万元
                            </div>
                        </div>
                    </div>
                    %{--第二行--}%
                    <div class="row">
                        <div class="form-group col-sm-4">
                            <label class="col-sm-3 control-label">企业名称</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="name" id="name" value="${params?.name}" placeholder="请输入企业名称">
                            </div>
                        </div>
                        <div class="form-group col-sm-4">
                            <label class="col-sm-3 control-label">经营状态</label>
                            <div class="col-sm-9 input-group" style="display: flex;justify-content: center">
                                <g:select class="form-control" name="operatingState" id="operatingState"
                                          from="${com.cindata.Account.constrainedProperties.operatingState.inList}"
                                          value="${params?.operatingState}"
                                          noSelection="${['': '请选择经营状态']}"/>
                            </div>
                        </div>
                        <div class="form-group col-sm-4">
                            <label class="col-sm-3 control-label">单位性质</label>
                            <div class="col-sm-9 input-group" style="display: flex;justify-content: center">
                                <g:select class="form-control" name="unitNature" id="unitNature"
                                          from="${com.cindata.dictionary.OrganizationNatureDict.list()}"
                                          valueMessagePrefix="status" optionKey="id" optionValue="name"
                                          value="${params?.unitNature}"
                                          noSelection="${['': '请选择单位性质']}"/>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </g:form>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <g:link action="mortgageAccountCreate" class="btn btn-info btn-xs"><i class="fa fa-plus"></i>新建</g:link>
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                &nbsp;&nbsp;
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="esateTable">
                        <thead>
                        <tr>
                            <g:sortableColumn property="name" title="企业名称" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="city" title="城市" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="district" title="行政区" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="unitNature" title="单位性质" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="phone" title="公司电话" class=" col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="operatingState" title="经营状态" class=" col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="registeredCapital" title="注册资金" class=" col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="creditAmount" title="信用额度" class=" col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="creditBalance" title="信用余额" class=" col-md-1 text-center" params="${params}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${accountList}">
                            <tr>
                                <td><g:link style="color: #3498DB" action="mortgageAccountShow" id="${it?.id}" class="firstTd">${it?.name}</g:link></td>
                                <td>${it?.city ? it?.city.name : '-'}</td>
                                <td>${it?.district ? it?.district?.name : '-'}</td>
                                <td>${it?.unitNature ? it?.unitNature?.name: '-'}</td>
                                <td>${it?.phone ? it?.phone : '-'}</td>
                                <td>${it?.operatingState ? it?.operatingState : '-'}</td>
                                <td>${it?.registeredCapital ? it?.registeredCapital : '-'}</td>
                                <td>${it?.creditAmount ? it?.creditAmount : '-'}</td>
                                <td>${it?.creditBalance ? it?.creditBalance : '-'}</td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate action="mortgageAccountIndex" total="${accountCount ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>
</div>

<g:javascript>
    function searchMap() {
        var city = $("#city").val();
        if(city=="-1"){
            toastr.error('请选择城市');
            return
        }
        window.location.href="/newMap/cluster?currentMap=clusterMap&city="+$("#city").val()+"&district="+$("#district").val()+"&communityId="+$("#communityId").val();
    }
    function show(id){
        var url = window.location.origin+"/account/show?id="+id;
        window.open(url)
    }
    //重置按钮
    $("#resetBtn").click(function () {
        $("#s2id_city span:first").html("请选择城市");
        $("#city").val("");
        $("#registeredCapitalStart").val("");
        $("#registeredCapitalEnd").val("");
        $("#name").val("");
        $("#creditLevel").val("");
        $("#s2id_operatingState span:first").html("请选择经营状态");
        $("#operatingState").val("");
        $("#s2id_unitNature span:first").html("请选择单位性质");
        $("#unitNature").val("");

    });
</g:javascript>

</body>
</html>
